package com.arpa.ntocc.common.common;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Collections;
import java.util.List;

/**
 * 分页
 * @Author liuyj
 * @Date 2019-11-22 18:47:07
 */
@Data
@ApiModel(value="分页对象", description="分页对象，包含页码信息，排序信息，合计信息")
public class Page<T> {

    public Page() {
        this.records = Collections.emptyList();
        this.total = 0L;
        this.pageNum = 1;
        this.pageSize = 10;
        this.sortType = "desc";
    }

    public Page(Integer pageNum,Integer pageSize) {
        this.pageNum = pageNum;
        this.pageSize = pageSize;
    }

    @ApiModelProperty(value = "数据列表")
    private List<T> records;

    @ApiModelProperty(value = "总数居量")
    private long total;

    @ApiModelProperty(value = "合计对象")
    private Object sumObject;

    @ApiModelProperty(value = "第几页")
    private Integer pageNum;

    @ApiModelProperty(value = "每页条数")
    private Integer pageSize;

    @ApiModelProperty(value = "排序字段")
    private String sortField;

    @ApiModelProperty(value = "排序方式")
    private String sortType;
}
